package com.logos.musicframe.adapter;


import com.logos.musicframe.entity.FileInfo;
import com.logos.musicframe.utils.AliOssUtil;
import org.springframework.beans.factory.annotation.Autowired;

import java.io.InputStream;
import java.util.LinkedList;
import java.util.List;

/**
 * @author logos
 * date 2025/6/04 21:26
 * @version v1.0
 * @Package com.logos.musicframe.adapter
 */
public class AliStorageAdapter implements StorageAdapter {
    @Autowired
    private AliOssUtil aliOssUtil;

    private String curUrl;

    @Override
    public void createBucket(String bucketName) {

    }

    @Override
    public String uploadFile(byte[] fileBytes, String bucket, String objectName, String originalFilename) {
        curUrl = aliOssUtil.upload(fileBytes,objectName);
        return curUrl;
    }

    @Override
    public List<String> getAllBucket() {
        List<String> bucketList = new LinkedList<>();
        bucketList.add("aliyunoss");
        return bucketList;
    }

    @Override
    public List<FileInfo> getAllFile(String bucket) {
        return null;
    }

    @Override
    public InputStream downLoad(String bucket, String objectName) {
        return null;
    }

    @Override
    public void deleteBucket(String bucket) {

    }

    @Override
    public void deleteObject(String bucket, String objectName) {

    }

    @Override
    public String getPreviewFileUrl(String bucketName, String objectName) {
        return null;
    }


    @Override
    public String getUrl(String bucket, String objectName) {
        return curUrl;
    }
}
